package com.itheima.reggie.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Setmeal;
import com.itheima.reggie.service.CategoryService;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class SetmealController {
    @Autowired
    private SetmealService setmealService;

    @Cacheable(value = "setmeal",key = "#categoryId")
    @GetMapping("/setmeal/list")
    public ResultInfo findList(long categoryId,
                               @RequestParam(defaultValue = "1") Integer status){
        List<Setmeal> setmealList = setmealService.findList(categoryId,status);
        return ResultInfo.success(setmealList);
    }
}
